package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.ProductSkuVo;
import com.spzx.product.api.factory.RemoteProductFallbackFactory;
import com.spzx.product.vo.SkuPriceVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(
        contextId = "remoteProductService",
        value = ServiceNameConstants.PRODUCT_SERVICE,
        fallbackFactory = RemoteProductFallbackFactory.class
)
public interface RemoteProductService {


    /**
     *
     * @param skuId 商品ID
     * @param source 内部系统调用请求头 收到设置
     * @return
     */
    @Operation(summary = "获取商品SKU详情")
    @GetMapping("/productSku/getProductSku/{skuId}")
    public R<ProductSkuVo> getProductSku(
            @Parameter(description = "skuId")
            @PathVariable("skuId") Long skuId,
            @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 根据单个SKUID查询商品价格
     * @param skuId
     * @return
     */
    @Operation(summary = "获取商品sku最新价格信息")
    @GetMapping(value = "/productSku/getSkuPrice/{skuId}")
    public R<SkuPriceVo> getSkuPrice(@PathVariable("skuId") Long skuId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    @Operation(summary = "批量获取商品sku最新价格信息")
    @PostMapping(value = "/productSku/getSkuPriceList")
    public R<List<SkuPriceVo>> getSkuPriceList(@RequestBody List<Long> skuIdList, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
